Skip to content

Add concurrent/multi-threaded tests for thread-safety verification#59

Merged
fabien-marty merged 1 commit intomainfrom
main-033
Mar 6, 2026
Merged

Add concurrent/multi-threaded tests for thread-safety verification#59
fabien-marty merged 1 commit intomainfrom
main-033

Conversation

@fabien-marty
Copy link
Copy Markdown
Owner

Summary

  • Adds test_storage_concurrent_get_set_delete and test_storage_concurrent_with_ttl to tests/test_storage.py
  • Adds test_cache_concurrent_get_set_delete_clear and test_cache_concurrent_with_ttl to tests/test_cache.py
  • All four tests use ThreadPoolExecutor to run multiple threads simultaneously on a shared instance, verifying no exceptions are raised and state stays consistent

Closes #50

Test plan

  • make test passes (40 tests, all green)
  • make lint passes

Made with Cursor

@fabien-marty
Copy link
Copy Markdown
Owner Author

@claude fix the conflict

@claude
Copy link
Copy Markdown

claude Bot commented Mar 6, 2026

Claude finished @fabien-marty's task in 9m 8s —— View job


Fixing merge conflict

  • Check for conflicts — branches had no common ancestor in shallow clone; main received close() call fixes after main-033 was branched
  • Apply origin/main codebase to main-033 — synced both test files with origin/main content + concurrent tests
  • Commit and push — dc99418

What was fixed

The main-033 branch was missing changes from origin/main commit cc68793 ("fix: add close() calls to test functions to prevent background thread leaks"):

tests/test_cache.py — added cache.close() at end of 16 test functions that were missing it

tests/test_storage.py — added storage.close() at end of 4 test functions + added missing expiration_thread_max_checks_per_iteration validation case to test_storage_invalid_parameters

The concurrent test additions from this PR (test_cache_concurrent_get_set_delete_clear, test_cache_concurrent_with_ttl, test_storage_concurrent_get_set_delete, test_storage_concurrent_with_ttl) are preserved unchanged.
|

@fabien-marty
Copy link
Copy Markdown
Owner Author

@claude rebase this

@claude
Copy link
Copy Markdown

claude Bot commented Mar 6, 2026

Claude finished @fabien-marty's task in 19s —— View job


Rebase request

I'm unable to perform a rebase on this branch. Rebasing rewrites commit history and requires a force push to update the remote branch — which I'm not permitted to do to avoid accidentally overwriting work.

To rebase manually, run:

git fetch origin
git checkout main-033
git rebase origin/main
git push --force-with-lease origin main-033

You can find more information about this limitation in the FAQ.


Closes #50

Adds four new tests exercising simultaneous get/set/delete/clear
operations from multiple threads on shared Storage and Cache instances,
including scenarios with an active TTL expiration thread.

Made-with: Cursor
@fabien-marty fabien-marty merged commit f214286 into main Mar 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests: No concurrent/multi-threaded tests for thread-safety verification

1 participant